

import { Component, OnInit, Injector, TemplateRef, ViewChild, Input } from '@angular/core';
import { NgZorroPageBaseComponent } from '../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component';
import { HttpService } from "../../core/service/http.service";
import { HttpClient } from "@angular/common/http";
import { Router, NavigationExtras } from "@angular/router";
import { ActivatedRoute } from '../../../../node_modules/@angular/router';
import { DomSanitizer } from '@angular/platform-browser';
import {
  AndOr, Compare, ExpressionPair, PagedResultDto, PagerSearchInput, ElementViewType, BaseComponentConfig,
  SystemFormControl, FieldType, ElementShowType, CustomNavigation, ClassInfoOutput, NavigatType, ArSystemFormControl, ClassSchool
} from "../..";
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { CityListComponent } from '../school/cityList';
import {
  FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators,
  FormControl
} from "@angular/forms";



@Component({
  selector: 'app-inform',
  templateUrl: './inform.component.html',
  styleUrls: ['./inform.component.scss']
})
export class InformComponent extends NgZorroPageBaseComponent implements OnInit {
  cityData;
  provinceData;
  selectedProvince;
  selectedCity;
  schoolName;
  collegelName;
  manalName;
  resultxy;
  resultxymana;
  aclear;
  classmana;
  delesh = [];
  disabledButton = true;
  displayData: Array<{ name: string; age: number; address: string; checked: boolean }> = [];
  dataSet = [];
  checkedNumber = 0;
  operating = false;
  smisVisible = false;
  isVisibleyc = false;
  studentmana = false;

  classid;
  allstudentdata = [];
  allChecked = false;
  indeterminate = false;
  deles; // 移除学生
  messagedata;


  name;
  sm;
  // className;
  async ngOnInit() {
    this.sm = sessionStorage.getItem('userRoleType'); // 身份
    this.getEntityList();
  }
  constructor(
    private activatedRoute: ActivatedRoute,
    public sanitizer: DomSanitizer,
    injecter: Injector,
    public http1: HttpService,
    private modalService: NzModalService,
    public http: HttpClient

  ) {
    super(injecter,
      new BaseComponentConfig(
          
      ));
  }
  check(id) {
    this.studentmana = true;
    this.httpService.get<any>("SendNotifications/GetOneMessage?id=" + id).then(e => {
      this.messagedata = e.message;
    });

  }
  assembleHTML(strHTML: any) {
    return this.sanitizer.bypassSecurityTrustHtml(this.messagedata);
  }

  removescs() {
    this.studentmana = false;
  }

  /**
  * 获取列表默认分页
  */
  async getEntityList() {
    try {
      this.loadingData = true;
      const searchBody = new PagerSearchInput(
          this.listEntities.currentPageIndex,
          this.listEntities.pageSize,
          this.listSearchValue,
          this.arSortableField);
      if ('2' === this.sm || '1' === this.sm ) {
        this.httpService.post<PagedResultDto<any>>("SendNotifications/GetInformationInMe", searchBody).then(e => {
          this.listEntities = e;
        });
      } else {
        this.httpService.post<PagedResultDto<any>>("SendNotifications/GetAllInformation", searchBody).then(e => {
          this.listEntities = e;
        });
      }
    } finally {
      this.refreshStatus();
      this.loadingData = false;
    }
  }
}
